//
//  File.swift
//
//
//  Created by didi on 2022/9/14.
//

import Vapor

final class SystemFileUploadForm: AbstractForm {
    var files: [File] = []

    init() {
        super.init()
        submit = "Upload"
        action.enctype = .multipart
    }

    @FormFieldBuilder
    override func createFields(_ req: Request) -> [FormField] {
        MultipleFileField("files")
            .read { [unowned self] _, field in
                self.files = field.input
            }
    }
}
